/**
 * Created with Intellij IDEA.
 * Description;
 * User:墨琦
 * Data:2023-09-14
 * Time:11:40
 */
public class Java_1 {
    public static void duplicateZeros(int[] arr) {
        int n = arr.length-1;
        int top = -1,cur=0;
        while(true)
        {
            if(arr[cur]!=0)
            {
                top++;
            }
            else top+=2;
            if(top>=n)
                break;
            cur++;
        }
        if(top>n)
        {
            top--;
            arr[top]=0;
            top--;cur--;
        }
        while(top>=0)
        {
            if(arr[cur]!=0)
            {
                arr[top]=arr[cur];
            }
            else {
                arr[top--] = 0;
                arr[top] =0;
            }
            cur--;
            top--;
        }
        System.out.println(".");
    }

    public static void main(String[] args) {
        int[] array={0,0,0,0,0,0,0};
        duplicateZeros(array);
        System.out.println("/n");
    }
}
